-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cert: Add AS certificate #2936
cert: Add AS certificate #2936
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)
go/lib/scrypto/cert/v2/base_json_test.go, line 38 at r1 (raw file):
"Valid": { Modify: func(_ *genCert) {}, ModifyExpected: func(_ *cert.AS) {},
Hm this will not work for cert.Issuer
. I also think it is a bit weird the base_json_test
tests concrete implementations.
How about having the functionality for testing here and actually call it in the implementation tests:
type baseTest struct {
Modify func(*genCert)
ExpectedErrMsg string
}
func baseUnmarshalJSONTests() map[string]baseTest {
return map[string]baseTest{
"Subject not set": {
Modify: func(g *genCert) {
g.Subject = nil
},
ExpectedErrMsg: cert.ErrSubjectNotSet.Error(),
}
}
}
and in as_json_test.go
type asTest struct {
baseTest
ModifyExpected func(*cert.AS)
}
func TestASUnmarshalJSON(t *testing.T) {
tests := map[string]asTest{...}
for name, bt := range baseUnmarshalJSONTests() {
tests[name] = asTest{baseTest: bt}
}
for name, test := range tests {
// test
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)
go/lib/scrypto/cert/v2/base_json_test.go, line 38 at r1 (raw file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
Hm this will not work for
cert.Issuer
. I also think it is a bit weird thebase_json_test
tests concrete implementations.
How about having the functionality for testing here and actually call it in the implementation tests:type baseTest struct { Modify func(*genCert) ExpectedErrMsg string } func baseUnmarshalJSONTests() map[string]baseTest { return map[string]baseTest{ "Subject not set": { Modify: func(g *genCert) { g.Subject = nil }, ExpectedErrMsg: cert.ErrSubjectNotSet.Error(), } } }and in
as_json_test.go
type asTest struct { baseTest ModifyExpected func(*cert.AS) } func TestASUnmarshalJSON(t *testing.T) { tests := map[string]asTest{...} for name, bt := range baseUnmarshalJSONTests() { tests[name] = asTest{baseTest: bt} } for name, test := range tests { // test } </blockquote></details> Done. <!-- Sent from Reviewable.io -->
This PR adds the AS certificate with parsing and validation. contributes to scionproto#2853
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2.
Reviewable status: complete! all files reviewed, all discussions resolved
This PR adds the AS certificate with parsing and validation.
contributes to #2853
This change is